package cn.e2win.biz.dbo;

import java.sql.Timestamp;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import cn.e2win.base.entity.BaseApproveI;
import cn.e2win.base.entity.BaseEntity;

@Entity
@Table(name = "project")
public class Project extends BaseEntity implements BaseApproveI{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

		//编号--结算单
		@Id
		@Basic(optional = false)
		@GeneratedValue(strategy = GenerationType.IDENTITY)
		@Column(name = "id", nullable = false)
		private Integer id;
		
		private Integer orgId;
		private Integer empId;
		private Integer adminUserId;//专管员ID

		private String projectName;//项目名称
		private Timestamp beginTime;
		@Transient
		private String projectType;//项目类别
		@Transient
		private String projectStage;//项目阶段
		@Transient
		private String projectAskFor;//项目诉求


		private String projectMarket;//市场痛点
		private String projectDesc;//项目说明
		private String projectRemark;//项目说明
		

		private String approveStatus="UNSUBMIT";//审核状态 默认为未提交
		@Transient
		private String approveDesc;//审核说明
		

		public Notice getApproveNotice(){
			Notice notice = new Notice(this);
			String msg = "";
			//提交审核时，发消息给adminUserId
			if("SUBMITED".equals(this.getApproveStatus())){
				notice.setToUserId(this.getAdminUserId());
				msg = "项目 【" + this.getProjectName() + "】 已提交审核，需要您的审核，请知晓！" ;
			}else if("APPROVED".equals(this.getApproveStatus()) || "REJECTED".equals(this.getApproveStatus())) {
				notice.setToUserId(this.getCreateById());
				if("APPROVED".equals(this.getApproveStatus())){
					msg = "项目 【" + this.getProjectName() + "】 已被审核通过，请知晓！";  
				}else if("REJECTED".equals(this.getApproveStatus())){
					msg = "项目 【" + this.getProjectName() + "】 已被审核驳回，请知晓！";
				}
				
			}
			notice.setNoticeType("APPROVE");
			notice.setNoticeDesc(msg);
			return notice;
		}

		
		
		
		public Integer getId() {
			return id;
		}
		public void setId(Integer id) {
			this.id = id;
		}
		
		

		public Integer getOrgId() {
			return orgId;
		}
		public void setOrgId(Integer orgId) {
			this.orgId = orgId;
		}
		public Integer getEmpId() {
			return empId;
		}
		public void setEmpId(Integer empId) {
			this.empId = empId;
		}
		public Integer getAdminUserId() {
			return adminUserId;
		}




		public void setAdminUserId(Integer adminUserId) {
			this.adminUserId = adminUserId;
		}




		public String getProjectName() {
			return projectName;
		}
		public void setProjectName(String projectName) {
			this.projectName = projectName;
		}

		public Timestamp getBeginTime() {
			return beginTime;
		}




		public void setBeginTime(Timestamp beginTime) {
			this.beginTime = beginTime;
		}




		public String getProjectType() {
			return projectType;
		}
		public void setProjectType(String projectType) {
			this.projectType = projectType;
		}
		public String getProjectStage() {
			return projectStage;
		}
		public void setProjectStage(String projectStage) {
			this.projectStage = projectStage;
		}
		public String getProjectAskFor() {
			return projectAskFor;
		}
		public void setProjectAskFor(String projectAskFor) {
			this.projectAskFor = projectAskFor;
		}
		public String getProjectMarket() {
			return projectMarket;
		}
		public void setProjectMarket(String projectMarket) {
			this.projectMarket = projectMarket;
		}
		public String getProjectDesc() {
			return projectDesc;
		}
		public void setProjectDesc(String projectDesc) {
			this.projectDesc = projectDesc;
		}
		public String getProjectRemark() {
			return projectRemark;
		}
		public void setProjectRemark(String projectRemark) {
			this.projectRemark = projectRemark;
		}
		public String getApproveStatus() {
			return approveStatus;
		}
		public void setApproveStatus(String approveStatus) {
			this.approveStatus = approveStatus;
		}
		public String getApproveDesc() {
			return approveDesc;
		}
		public void setApproveDesc(String approveDesc) {
			this.approveDesc = approveDesc;
		}
		@Override
		public String getEntityNo() {
			return projectName;
		}

		
}
